<template>
  <div class="tab-bar-list-item" @click="handlePathSkip">
    <div class="image" v-if="!isActive">
      <slot name="img"></slot>
    </div>
    <div class="image" v-else>
      <slot name="img-active"></slot>
    </div>
    <div class="text">
      <slot name="text"></slot>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      geohash: {},
    };
  },
  props: {
    path: {
      type: String,
      default: "/msite",
    },
  },
  computed: {
    isActive() {
      return this.$route.path.includes(this.path);
    },
  },
  mounted() {
    this.$bus.$on("getSpecificAddress", (res) => {
      this.geohash = res.geohash;
    });
  },
  methods: {
    handlePathSkip() {
      
      if (this.path === "/msite") {
        this.$router.push(`${this.path}?geohash=${this.geohash}`);
      }else {
        this.$router.push(this.path)
      }
    },
  },
};
</script>
<style scoped>
.tab-bar-list-item {
  text-align: center;
  font-size: 12px;
}
.tab-bar-list-item .image img {
  width: 20px;
  height: 20px;
  margin-bottom: 2px;
  vertical-align: middle;
}
.tab-bar-list-item .text {
}
</style>